﻿using Newtonsoft.Json;

namespace AutomationCommand
{
    public class excel_option : BasiCommand
    {
        [JsonProperty("fun_type")]
        public string FunType { get; set; }

        [JsonProperty("othername")]
        public string OtherName { get; set; }

        [JsonProperty("path")]
        public string Path { get; set; }

        [JsonProperty("visible")]
        public string Visible { get; set; }

        [JsonProperty("option")]
        public string Option { get; set; }

        [JsonProperty("position")]
        public Position Position { get; set; }

        [JsonProperty("size")]
        public Size Size { get; set; }

        [JsonProperty("data")]
        public string Data { get; set; }

        [JsonProperty("dir")]
        public string Dir { get; set; }

        public excel_option()
        {
            FunType = "excel_option";
            OtherName = "EXCEL操作";
            Path = "";
            Visible = "true";
            Option = "";
            Position = new Position
            {
                Page = "",
                Rows = new Range
                {
                    S = "1",
                    E = "1"
                },
                Colums = new Range
                {
                    S = "1",
                    E = "1"
                }
            };
            Size = new Size
            {
                W = "50",
                H = "20"
            };
            Data = "";
            Dir = "";
            SuccessJump = -1;
            FailureJump = -1;
        }

        public bool Execute()
        {
            // 在这里编写执行EXCEL操作命令的逻辑
            // 返回执行结果
            return true; // 假设此处始终成功
        }
    }

    public class Position
    {
        [JsonProperty("page")]
        public string Page { get; set; }

        [JsonProperty("rows")]
        public Range Rows { get; set; }

        [JsonProperty("colums")]
        public Range Colums { get; set; }
    }

    public class Range
    {
        [JsonProperty("s")]
        public string S { get; set; }

        [JsonProperty("e")]
        public string E { get; set; }
    }

}
